<HTML>
<HEAD>
    <title>分屏翻译</title>
</HEAD>
<FRAMESET COLS='50%25,*'>
    <FRAME id="fm1" SRC='https://projects.spring.io/spring-security-oauth/docs/oauth2.html'>
    <FRAME id="fy" SRC='https://projects.spring.io/spring-security-oauth/docs/oauth2.html'>
</FRAMESET>

<script>function fanyi() {
    var selectstr = document.getElementById("fm1").contentWindow.window.getSelection().toString();
    var fy = document.getElementById("fy");
    var fyurl = "https://fanyi.baidu.com/#auto/zh/" + selectstr;    /*fy.setAttribute("src",fyurl);*/
}

var settime = window.setInterval(function () {
    if (document.getElementById("fm1").contentWindow.window.onclick == null) {
        document.getElementById("fm1").contentWindow.document.onclick = function () {
            if (document.getElementById("fm1").contentWindow.window.getSelection().toString() != "") {
                parent.window.fanyi();
            }
        }
    }
}, 3000);</script>
</HTML>